package exception;

public class ThrowDemo {
    public static void main(String[] args) {
        Person p = new Person();
        try{
            p.setAge(1000);//违背设计要求
        }catch (IllegalAgeException e){
            e.printStackTrace();
        }
        System.out.println("此人年龄为"+p.getAge()+"岁");
    }
}
